﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Localization;

namespace PMS.Data.EntityMap.Common
{
    /// <summary>
    /// Represents a Language mapping configuration
    /// </summary>
    public partial class LanguageMap : PMSEntityTypeConfiguration<Language>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<Language> builder)
        {
            builder.ToTable("sys_languages");
            builder.HasKey(lang => lang.Id);

            builder.Property(lang => lang.DisplayName).HasMaxLength(32).IsRequired();
            builder.Property(lang => lang.CultureCode).HasMaxLength(32).IsRequired();
            builder.Property(lang => lang.LanguageCode).HasMaxLength(32).IsRequired();

            base.Configure(builder);
        }

        #endregion
    }
}
